const express     = require('express');
const router      = express.Router();
const getWxConfig = require('../wx/wxsdk');

router.get('/', function (req, res, next) {
    const title = '车捕头';

    getWxConfig().then(config => {
        res.renderPage('index', {
            title: title,
            timestamp: config.timestamp,
            nonceStr: config.noncestr,
            signature: config.signature
        });
    });
});

router.get('/wxconfig', function (req, res, next) {
    getWxConfig().then(config => {
        res.send(config)
    });
});

module.exports = router;
